// Author: Bjorn Schobben

#ifndef CLOCK_H
#define CLOCK_H

#include <string>

//Class representing the timer used in the game
class Clock
{
public:
	enum ClockType { ASCENDING, DESCENDING };
	
	//Constructor
	Clock(ClockType type = ASCENDING);
	Clock(int time);
	
	//Destructor
	virtual ~Clock();

	//Operations on the time value
	virtual void Start(int newTime=0);
	virtual void Stop();

	void Reset();
	void Tick();
	void Increase(int inc);
	const int GetTime() const;	
	const ClockType GetType() const;
	const int GetLifeTime() const;
	

	
	std::string TimeToString();
protected:
	virtual void UpdateDisplay();
	virtual void Timeout();

private:
	//The current value of the time
	int time;
	//The initial value of the time
	int initialTime;
	//The active state of the clock
	bool active;
	//The clocktype (ascending, descending)
	ClockType type;
	// Life time of the clock
	int lifeTime;
};

#endif //CLOCK_H
